#include "ZigbusMeteoType.h"

ZigbusMeteoType::ZigbusMeteoType()
    : ZigbusItem(-1, METEO_TYPE_SIZE)
{
}

ZigbusMeteoType::ZigbusMeteoType(int value)
    : ZigbusItem(value, METEO_TYPE_SIZE)
{
}

ZigbusMeteoType::ZigbusMeteoType(const QString &str)
    : ZigbusItem(-1, METEO_TYPE_SIZE)
{
    if(str.toLower() == "dht11") setValue(METEO_TYPE_DHT11);
    else if(str.toLower() == "lm35dz") setValue(METEO_TYPE_LM35DZ);
}

ZigbusMeteoType::ZigbusMeteoType(const ZigbusMeteoType &other)
    : ZigbusItem(other)
{
}

QString ZigbusMeteoType::text() const
{
    switch(getValue()) {
    case METEO_TYPE_UNDEFINED: return "UNDEFINED";
    case METEO_TYPE_DHT11: return "DHT11";
    case METEO_TYPE_LM35DZ: return "LM35DZ";
    default: return ZigbusItem::text();
    }
}
